var RegisterPageJs = function() {
	var self = this;
	
	var _private = new Object();
	
	_private.init = function() {
		$("#projectname").on("focusout", _private.PROJECT_NAME_KEYUP);
	};
	
	_private.PROJECT_NAME_KEYUP = function(e) {
		$.ajax({
			type: 'POST',
			dataType: 'json',
			data: {name: $("#projectname").val()},
			url: '/stepup/project/isUnique',
			success: function(data){
				var errorPlacement = $("#projectname").parent().parent().find(".error_tooltip");
				if(data == true){
					errorPlacement.html("Project name must be unique!");
					$("#uniqproj").val("1");
				} else {
					errorPlacement.html("");
					$("#uniqproj").val("0");
				}
				
			}
		});
	};
	_private.init();
};